from django.conf import settings

#print 'DATABASES : %s' % (settings.DATABASES)
config_file=open('databases','r')
#print config_file.read()

app=None
engine=None
name = None

for i, line in enumerate(config_file):

	if line.find('database:')>=0:
		app = line.split(':')[1].strip()
		settings.DATABASES[app]={}
		i+=1
		line=config_file.next()

		engine='django.db.backends.'+line.split(':')[1].strip() if line.find('engine:')>=0 else ''
		settings.DATABASES[app]['ENGINE']=engine
		i+=1
		line=config_file.next()

		name = line.split(':')[1].strip() if line.find('name:')>=0 else ''
		settings.DATABASES[app]['NAME']=name

